import matplotlib.pyplot as plt
import numpy as np

if __name__ == '__main__':
    points = [[0, 0], [0, 5], [3, 5], [3, 4], [1, 4],
              [1, 3], [2, 3], [2, 2], [1, 2], [1, 0]]
    x = [point[0] for point in points]
    y = [point[1] for point in points]
    plt.figure(figsize=(5, 5))  # figure大小，单位为英尺
    plt.xlim(-10, 10)  # x的范围
    plt.ylim(-10, 10)  # y的范围
    plt.plot(x, y)
    # plt.show()

    P = np.matrix(points)
    # 缩放变换
    T = np.matrix([[2, 0], [0, 1.5]])
    P = T * P.T
    # print(P)
    points = P.tolist()
    x = [point[0] for point in points]
    y = [point[1] for point in points]
    plt.plot(x, y)
    plt.show()
